import Cookies from 'js-cookie'
//Cookie是用天来计时的
export const setCookies = (name:string,value:string,days?:number,path:string =''):void =>{
    if(window.localStorage) {
        localStorage.setItem(name,value)
    } else {
        Cookies.set(name,value,{expires:days,path:path})
    }
}

export const getCookies = (name: string): null | undefined | string =>{
    if(window.localStorage){
        return localStorage.getItem(name)
    }else{
        return Cookies.get(name)
    }
}

export const removeCookies = (name: string,path:string =''):void => {
    if (window.localStorage) {
        localStorage.removeItem(name)
      } else {
        Cookies.remove(name,{path:path});
      }
}